[id].vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <div class="container pt-8 pb-4">
  3. <div class="flex items-center mb-8">
  4. <div>
  5. <h1 class="text-2xl max-w-sm text-overflow font-semibold">
  6. {{ activeLog.name }}
  7. </h1>
  8. <p class="text-gray-600">
  9. <span class="capitalize">
  10. {{
  11. activeLog.status === 'success' ? 'succeeded' : activeLog.status
  12. }}
  13. </span>
  14. <span
  15. :title="dayjs(activeLog.startedAt).format('DD MMM YYYY, hh:mm A')"
  16. >
  17. on {{ dayjs(activeLog.startedAt).format('DD MMM') }}
  18. </span>
  19. in {{ countDuration(activeLog.startedAt, activeLog.endedAt) }}
  20. </p>
  21. </div>
  22. <div class="flex-grow"></div>
  23. <ui-input prepend-icon="riSearch2Line" placeholder="Search..." />
  24. </div>
  25. <div class="flex items-start">
  26. <ui-list class="w-7/12 mr-6" style="height: 900px">
  27. <ui-list-item v-for="(item, index) in activeLog.history" :key="index">
  28. <span
  29. :title="item.message || item.type"
  30. :class="logsType[item.type].color"
  31. class="p-1 rounded-lg align-middle inline-block mr-2"
  32. >
  33. <v-remixicon :name="logsType[item.type].icon" size="20" />
  34. </span>
  35. <p class="flex-1 text-overflow">
  36. {{ item.name }}
  37. </p>
  38. <p class="text-gray-600">
  39. {{ countDuration(0, item.duration || 0) }}
  40. </p>
  41. </ui-list-item>
  42. </ui-list>
  43. <div class="w-5/12 logs-details sticky top-10">
  44. <logs-data-viewer :log="activeLog" />
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script setup>
  50. import { computed } from 'vue';
  51. import { useRoute } from 'vue-router';
  52. import Log from '@/models/log';
  53. import dayjs from '@/lib/dayjs';
  54. import { countDuration } from '@/utils/helper';
  55. import LogsDataViewer from '@/components/newtab/logs/LogsDataViewer.vue';
  56. const logsType = {
  57. success: {
  58. color: 'bg-green-200',
  59. icon: 'riCheckLine',
  60. },
  61. stop: {
  62. color: 'bg-yellow-200',
  63. icon: 'riStopLine',
  64. },
  65. error: {
  66. color: 'bg-red-200',
  67. icon: 'riErrorWarningLine',
  68. },
  69. finish: {
  70. color: 'bg-blue-200',
  71. icon: 'riFlagLine',
  72. },
  73. };
  74. const route = useRoute();
  75. const activeLog = computed(() => Log.find(route.params.id));
  76. setTimeout(() => {
  77. console.log(activeLog.value);
  78. }, 2000);
  79. </script>
  80. <style>
  81. .logs-details .my-editor {
  82. max-height: calc(100vh - 12rem);
  83. }
  84. </style>